package cn.jobstart.enums;

/**
 * @author sunke
 * @Date 2023-09-06 14:17:03
 * @description 渠道
 */

import cn.jobstart.common.StringUtil;
import cn.jobstart.pubInter.EnumVO;

import java.util.ArrayList;
import java.util.List;

public enum TalentSubscriptionTaskChannelEnum {

    BOSS(1, "boss直聘"),
    ZHI_LIAN(2, "智联招聘"),
    JOB51(4, "前程无忧"),
    NBRC(8, "宁波人才网"),
    LIE_PIN(16, "猎聘");


    private Integer type;
    private String desc;

    TalentSubscriptionTaskChannelEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static String getDescByType(Integer type) {
        if (type == null) {
            type = 0;
        }
        String desc="";
        for (TalentSubscriptionTaskChannelEnum var : TalentSubscriptionTaskChannelEnum.values()) {
            if ((type.intValue() & var.getType().intValue()) == var.getType().intValue()) {
                desc=var.getDesc()+"、";
            }
        }
        if(StringUtil.isNotObjEmpty(desc)){
            return desc.substring(0,desc.length()-1);
        }
        return "";
    }

    public static List<EnumVO> getDescs() {
        List list = new ArrayList();

        for (TalentSubscriptionTaskChannelEnum var : TalentSubscriptionTaskChannelEnum.values()) {
            EnumVO enumVO = new EnumVO();
            enumVO.setId(var.getType() + "");
            enumVO.setName(var.getDesc());
            list.add(enumVO);
        }


        return list;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
